package inforio.mobile.agricola;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.Spinner;

public class IRAgricolaActivity extends Activity {
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        
        setContentView(R.layout.main);
        
        
        final Spinner spinner = (Spinner) findViewById(R.id.spinner1);
        ArrayAdapter<CharSequence> adapter = ArrayAdapter.createFromResource(
                this, R.array.itens_menu, android.R.layout.simple_spinner_item);
        adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
        spinner.setAdapter(adapter);
        
        final Button button = (Button) findViewById(R.id.button1);
        button.setOnClickListener(new View.OnClickListener() {
            public void onClick(View v) {
            	
            	Integer op = spinner.getSelectedItemPosition(); 
            	if( op == 1 )
            	  	startActivity(new Intent(IRAgricolaActivity.this, frm001.class));
            	else if ( op==0 )
               	  	startActivity(new Intent(IRAgricolaActivity.this, frmini.class));
            	else
            		startActivity(new Intent(IRAgricolaActivity.this, frm002.class));
            }
        }); 
    }
}